#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
using namespace std;
int main()
{
    // freopen("case.txt", "r", stdin);
    int k, p = 1, i, j, u, pos[55];
    cin >> k;
    while (true)
    {
        scanf("%d", &u);
        pos[p++] = u;
        char c = getchar();
        if (c == '\n')
            break;
    }

    u = 1;
    string source[55], result[55];
    for (i = 0; i < 4; i++)
    {
        string head;
        if (i == 0)
            head = "S";
        if (i == 1)
            head = "H";
        if (i == 2)
            head = "C";
        if (i == 3)
            head = "D";
        for (j = 1; j <= 13; j++, u++)
        {
            source[u] = head + to_string(j);
            result[u] = source[u];
        }
    }
    source[53] = "J1";
    source[54] = "J2";

    
    for (i = 0; i < k; i++)
    {
        for(j = 1; j < p; j ++)
        {
            result[pos[j]] = source[j];
        }
        for(j = 1;j <= 54; j ++)
            source[j] = result[j];
    }
    for (j = 1; j <= 54; j++)
    {
        if(j == 1)
        cout << result[j];
        else
            cout << " "<< result[j];
    }
    return 0;
}